Skip to content

refactor: reorganize features/shared directory for better maintainability#730

Merged
Wirasm merged 3 commits intomainfrom
refactor/reorganize-features-shared
Sep 22, 2025
Merged

refactor: reorganize features/shared directory for better maintainability#730
Wirasm merged 3 commits intomainfrom
refactor/reorganize-features-shared

Conversation

@Wirasm
Copy link
Copy Markdown
Collaborator

@Wirasm Wirasm commented Sep 22, 2025

Pull Request

Summary

Reorganizes the features/shared directory into a cleaner, more maintainable structure following vertical slice architecture patterns. This improves code organization without any functional changes.

Changes Made

  • Created organized subdirectories within features/shared/:
    • api/ - API clients and HTTP utilities (renamed apiWithEtag.ts to apiClient.ts)
    • config/ - Configuration files (queryClient.ts, queryPatterns.ts)
    • types/ - Shared type definitions (errors.ts)
    • utils/ - Pure utility functions (optimistic.ts, clipboard.ts)
    • hooks/ - Shared React hooks (already existed)
  • Updated all import paths across ~48 files to reflect new structure
  • Updated all AI documentation in PRPs/ai_docs/ to match new paths
  • Applied Biome formatting to affected files

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring

Affected Services

  • Frontend (React UI)
  • Server (FastAPI backend)
  • MCP Server (Model Context Protocol)
  • Agents (PydanticAI service)
  • Database (migrations/schema)
  • Docker/Infrastructure
  • Documentation site

Testing

  • All existing tests pass
  • Added new tests for new functionality
  • Manually tested affected user flows
  • Docker builds succeed for all services

Test Evidence

# Unit tests for moved files
npm run test:run src/features/shared/
# ✓ All 34 tests passed

# Build validation
npm run build
# ✓ Build completed successfully

# TypeScript validation
npx tsc --noEmit
# ✓ No import resolution errors

# Dev server
npm run dev
# ✓ Server starts without errors

Checklist

  • My code follows the service architecture patterns
  • If using an AI coding assistant, I used the CLAUDE.md rules
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass locally
  • My changes generate no new warnings
  • I have updated relevant documentation
  • I have verified no regressions in existing features

Breaking Changes

None - this is a pure refactoring with no functional changes. All imports have been updated to maintain backward compatibility.

Additional Notes

  • This refactoring improves code organization and maintainability
  • Follows the vertical slice architecture pattern used throughout the codebase
  • All tests continue to pass
  • Build and runtime behavior unchanged
  • Documentation updated to reflect new structure

Summary by CodeRabbit

  • Refactor

    • Centralized data-fetching and caching configuration for consistency across the app.
    • Reorganized shared utilities and API client locations with no behavioral regressions.
  • New Features

    • Added additional standard cache durations (normal, rare, static) for better background refresh.
    • Projects list now uses smart polling for more adaptive refresh intervals.
  • Documentation

    • Updated architecture and data-fetching docs to reflect the new structure.
  • Style

    • Minor UI text and formatting cleanups.
  • Tests

    • Updated test imports/mocks to match reorganized modules; test logic unchanged.

- Created organized subdirectories for better code organization:
  - api/ - API clients and HTTP utilities (renamed apiWithEtag.ts to apiClient.ts)
  - config/ - Configuration files (queryClient, queryPatterns)
  - types/ - Shared type definitions (errors)
  - utils/ - Pure utility functions (optimistic, clipboard)
  - hooks/ - Shared React hooks (already existed)

- Updated all import paths across the codebase (~40+ files)
- Updated all AI documentation in PRPs/ai_docs/ to reflect new structure
- All tests passing, build successful, no functional changes

This improves maintainability and follows vertical slice architecture patterns.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 22, 2025

Walkthrough

Shared modules were reorganized: queryClient and queryPatterns moved to shared/config, apiWithEtag consolidated as shared/api/apiClient, optimistic utilities moved to shared/utils. Imports across code, tests, and docs were updated. New STALE_TIMES entries (normal, rare, static) added; apiClient header logic now sets Content-Type only when a body is present.

Changes

Cohort / File(s) Summary
Config relocation
archon-ui-main/src/App.tsx, archon-ui-main/src/features/testing/test-utils.tsx, .../features/*/**/use*Queries.ts, .../inspector/hooks/useInspectorPagination.ts, .../progress/hooks/tests/useProgressQueries.test.ts, .../settings/**/use*Queries.ts, .../projects/documents/hooks/useDocumentQueries.ts
Moved queryClient and queryPatterns into shared/config/* and updated imports to .../config/queryClient and .../config/queryPatterns. Added STALE_TIMES.normal, STALE_TIMES.rare, STALE_TIMES.static. No runtime logic changes.
API client (ETag) consolidation
archon-ui-main/src/features/shared/api/apiClient.ts, archon-ui-main/src/components/layout/hooks/useBackendHealth.ts, .../features/*/services/*Service.ts, .../features/mcp/services/mcpApi.ts, .../features/projects/tasks/services/tests/taskService.test.ts, .../features/shared/api/tests/apiClient.test.ts
Replaced apiWithEtag references with api/apiClient; updated tests/mocks. In apiClient.ts, Content-Type header set only when request has a body and method normalized; imports for API base and error types updated.
Optimistic utilities move
.../features/*/**/components/*Card.tsx, .../features/*/**/hooks/use*Queries.ts, archon-ui-main/src/features/shared/hooks/useToast.ts, archon-ui-main/src/features/shared/utils/tests/optimistic.test.ts
Moved optimistic utilities to shared/utils/optimistic and updated import sites (including createOptimisticId). No API/behavior changes.
Knowledge optimistic context changes
archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
Mutation context shapes changed: removed tempItemId, now include/return tempProgressId; reconciliation now compares item.source_id with server IDs. Exported mutation-context types updated accordingly.
Projects: smart polling & keys
archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
Added useSmartPolling to compute refetchInterval for project list queries; introduced exported projectKeys; useProjectFeatures given explicit typed return. Minor mutation invalidation updates.
Error/type path normalization
.../features/progress/hooks/useProgressQueries.ts, .../features/projects/services/projectService.ts, .../features/projects/tasks/services/taskService.ts, .../features/shared/api/tests/apiClient.test.ts
Updated imports for APIServiceError and related error types to shared/types/errors. No behavior changes.
Import cleanup & formatting
.../knowledge/inspector/components/KnowledgeInspector.tsx, .../projects/documents/components/DocumentCard.tsx, .../features/mcp/components/McpConfigSection.tsx, .../features/settings/**/*
Deduplicated/reordered imports (e.g., copyToClipboard, useToast) and minor JSX formatting edits. No functional changes.
Docs & ai_docs updates
PRPs/ai_docs/*
Documentation updated to reflect new file paths, renamed api client, and STALE_TIMES additions. No semantics changes.
Shared hooks index
archon-ui-main/src/features/shared/hooks/index.ts
Formatting/newline only.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor UI
  participant useProjects as useProjectsHook
  participant SmartPoll as useSmartPolling
  participant QueryClient as TanStackQuery
  participant API as projectService

  UI->>useProjects: mount
  useProjects->>SmartPoll: compute refetchInterval
  SmartPoll-->>useProjects: interval
  useProjects->>QueryClient: register query (projects/list) with refetchInterval & staleTime
  QueryClient->>API: fetch /projects (on mount/refetch)
  API-->>QueryClient: projects payload
  QueryClient-->>UI: updated data
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • coleam00
  • leex279

Poem

I hopped through imports, neat and spry,
Moved configs, clients, and STALE_TIMES high.
Optimistic tails tucked into place,
Project polls now dance with steady pace.
This rabbit fixed the paths — a tidy try. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description Check ❓ Inconclusive The PR description follows the repository template and includes Summary, Changes Made, Type of Change (refactor), Affected Services, Testing with commands/results, Checklist, and a Breaking Changes section. However, the raw file summaries show at least one exported API/type change (mutation context types in archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts) which contradicts the "No breaking changes" claim and is not enumerated in the description. Because of this discrepancy the description is not fully reliable for reviewers without further clarification. Please update the PR description to explicitly list any public API or type/signature changes (for example the useKnowledgeQueries mutation context changes), confirm whether those changes are breaking or internal-only, and add any required migration steps or links to tests that verify no regressions so reviewers can validate the claim of "no breaking changes."
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title concisely and accurately summarizes the primary change — a refactor that reorganizes the features/shared directory for maintainability; it is brief, uses conventional commit style, and clearly communicates the main intent for history scanning.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/reorganize-features-shared

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cee1c0a and 435e5c1.

📒 Files selected for processing (2)
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (3 hunks)
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (1)

312-318: Fix: upload success doesn’t replace optimistic item (id vs source_id mismatch)

Optimistic upload item sets source_id to tempProgressId, but onSuccess matches by item.id. This can leave the optimistic item un-reconciled until a refetch, causing duplicates or stale progress links.

Apply this minimal patch to match by source_id and drop the unused tempItemId in this mutation’s context:

@@
-    {
-      previousSummaries?: Array<[readonly unknown[], KnowledgeItemsResponse | undefined]>;
-      previousOperations?: ActiveOperationsResponse;
-      tempProgressId: string;
-      tempItemId: string;
-    }
+    {
+      previousSummaries?: Array<[readonly unknown[], KnowledgeItemsResponse | undefined]>;
+      previousOperations?: ActiveOperationsResponse;
+      tempProgressId: string;
+    }
@@
-      const tempItemId = optimisticItem.id;
@@
-      return { previousSummaries, previousOperations, tempProgressId, tempItemId };
+      return { previousSummaries, previousOperations, tempProgressId };
@@
-        queryClient.setQueriesData<KnowledgeItemsResponse>({ queryKey: knowledgeKeys.summariesPrefix() }, (old) => {
+        queryClient.setQueriesData<KnowledgeItemsResponse>({ queryKey: knowledgeKeys.summariesPrefix() }, (old) => {
           if (!old) return old;
           return {
             ...old,
             items: old.items.map((item) => {
-              if (item.id === context.tempItemId) {
+              if (item.source_id === context.tempProgressId) {
                 return {
                   ...item,
                   source_id: response.progressId,
                 };
               }
               return item;
             }),
           };
         });

Also applies to: 332-356, 413-414, 419-434

🧹 Nitpick comments (21)
archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts (2)

67-90: Add one more assertion to cover primitives in getProviderErrorMessage.

You verify primitives don’t throw in parse; consider asserting the user‑facing message behavior too (string echoes; falsy numbers fall back).

Apply this diff to add a focused test:

@@
   it("should return original message for non-provider errors", () => {
     const error = new Error("Network connection failed");
     const result = getProviderErrorMessage(error);
     expect(result).toBe("Network connection failed");
   });
+
+  it("should handle primitive inputs in getProviderErrorMessage", () => {
+    expect(getProviderErrorMessage("plain error")).toBe("plain error");
+    expect(getProviderErrorMessage(0)).toBe("An error occurred.");
+  });

230-237: Quote style inconsistent with Biome rule (double quotes).

One test title uses single quotes; align with repository’s double‑quote convention.

Apply this diff:

-    it('should handle edge case: message contains "detail" but is not JSON', () => {
+    it("should handle edge case: message contains \"detail\" but is not JSON", () => {
archon-ui-main/src/features/mcp/components/McpConfigSection.tsx (2)

5-5: Use alias import for consistency with shared hooks

Align with existing "@/features/..." imports to reduce fragile relative paths after the reorg.

-import { copyToClipboard } from "../../shared/utils/clipboard";
+import { copyToClipboard } from "@/features/shared/utils/clipboard";

327-329: Microcopy cleanup and summary mismatch

The AI summary says "currently" was removed, but it still appears. Also the sentence is repetitive. Suggest clearer wording below.

-                according to your system. This setup is complex right now because Codex has some bugs with MCP
-                currently.
+                according to your system. This setup can be more involved due to known Codex MCP issues.

Additionally, this block (and the label on Line 340) uses navigator.platform directly. If SSR is enabled anywhere, this will throw at render time. Consider guarding usage:

// near component top
const isWindows = typeof navigator !== "undefined" && /win/i.test(navigator.platform);

// replace occurrences:
{isWindows ? "Windows" : "Linux/macOS"}

Inside codex configGenerator, guard similarly:

const isWindows =
  typeof navigator !== "undefined" && navigator.platform.toLowerCase().includes("win");
archon-ui-main/src/features/projects/documents/components/DocumentCard.tsx (4)

68-80: Clear the copy timeout on unmount to avoid setState after unmount.

Small but real edge case: if the card unmounts before the 2s timer fires, setIsCopied(false) can run post‑unmount. Use a ref + cleanup.

Apply this diff:

-import { memo, useCallback, useState } from "react";
+import { memo, useCallback, useEffect, useRef, useState } from "react";

   const [showDelete, setShowDelete] = useState(false);
   const [isCopied, setIsCopied] = useState(false);
+  const copyTimeoutRef = useRef<number | null>(null);

   const handleCopyId = useCallback(
     async (e: React.MouseEvent) => {
       e.stopPropagation();
       const result = await copyToClipboard(document.id);
       if (result.success) {
         setIsCopied(true);
-        setTimeout(() => setIsCopied(false), 2000);
+        if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
+        copyTimeoutRef.current = window.setTimeout(() => setIsCopied(false), 2000);
       }
     },
     [document.id],
   );
+
+  useEffect(() => {
+    return () => {
+      if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
+    };
+  }, []);

92-113: Minor a11y: add an explicit label to the container button.

You’ve handled keyboard interactions; add an aria-label for clearer SR output when focus lands on the card container.

-    <div
+    <div
       role="button"
       tabIndex={0}
+      aria-label={`Open ${document.title}`}

82-88: Narrow useCallback deps to reduce needless re-creations.

handleDelete depends on document object identity; if the parent passes a new object each render, this callback rememoizes frequently. Pass only document.id and look up as needed, or keep as-is if parent memoizes.

-  const handleDelete = useCallback(
-    (e: React.MouseEvent) => {
-      e.stopPropagation();
-      onDelete(document);
-    },
-    [document, onDelete],
-  );
+  const handleDelete = useCallback(
+    (e: React.MouseEvent) => {
+      e.stopPropagation();
+      onDelete(document);
+    },
+    [document.id, onDelete], // consider narrowing to stable fields
+  );

16-16: Consider path aliases to avoid brittle ../../../ imports.

Optional: after configuring TS path aliases (e.g., @features/*), switch to an absolute import for maintainability.

-import { copyToClipboard } from "../../../shared/utils/clipboard";
+// after tsconfig.json paths are configured
+import { copyToClipboard } from "@features/shared/utils/clipboard";
archon-ui-main/src/features/mcp/services/mcpApi.ts (1)

1-1: Prefer alias import for consistency with the rest of the refactor

Most files use "@/features/…" paths; switch this relative import to the alias for uniformity and easier moves.

-import { callAPIWithETag } from "../../shared/api/apiClient";
+import { callAPIWithETag } from "@/features/shared/api/apiClient";
archon-ui-main/src/features/settings/migrations/services/migrationService.ts (1)

14-16: Tighten types by using generics instead of casts

Avoid as casts and let the API helper carry the return type.

// Before
const response = await callAPIWithETag("/api/migrations/status");
return response as MigrationStatusResponse;

// After
const response = await callAPIWithETag<MigrationStatusResponse>("/api/migrations/status");
return response;

Apply similarly in getMigrationHistory() and getPendingMigrations().

Also applies to: 27-29, 40-41

archon-ui-main/src/features/shared/api/tests/apiClient.test.ts (2)

9-9: Rename suite to match file/module name

Update the describe label to reflect apiClient.

-describe("apiWithEtag", () => {
+describe("apiClient (callAPIWithETag)", () => {

1-413: Clean up meta terms in comments per repo guidelines

Replace terms like “simplified”/“removed” with functional descriptions (what the code does today). Example replacements:

  • “we removed explicit ETag handling” → “ETag negotiation is handled by the browser; this function performs a standard fetch.”
  • “simplified approach” → “integration with TanStack Query’s staleTime and the browser HTTP cache.”
archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (2)

13-13: Import path update LGTM; consider switching to alias for consistency

Across the repo many imports use "@/features/...". To reduce brittle relative paths and ease future moves, consider using the alias here.

-import { isOptimistic } from "../../shared/utils/optimistic";
+import { isOptimistic } from "@/features/shared/utils/optimistic";

13-13: Standardize optimistic util imports to "@/features/shared/utils/optimistic"

Replace remaining relative imports:

  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx — import at line 13
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx — import at line 5
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx — import at line 4

Hooks already use the alias:

  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts

apiWithEtag appears only in:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts:9
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts (1)

3-3: Path remap to shared/config/queryPatterns is correct; prefer alias path

Minor consistency nit: imports in this file mix alias and relative paths. Consider aliasing this one, too.

-import { STALE_TIMES } from "../../shared/config/queryPatterns";
+import { STALE_TIMES } from "@/features/shared/config/queryPatterns";
archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts (1)

2-2: Import path update looks good; optional alias tweak

Align with the alias convention used elsewhere for maintainability.

-import { DISABLED_QUERY_KEY, STALE_TIMES } from "../../../shared/config/queryPatterns";
+import { DISABLED_QUERY_KEY, STALE_TIMES } from "@/features/shared/config/queryPatterns";
archon-ui-main/src/features/shared/api/apiClient.ts (2)

14-15: Imports adjusted to new locations — verify API_BASE_URL is SSR/test safe

Per prior guidance, prefer lazy getters (e.g., getApiFullUrl/getApiUrl) in config to avoid window access at module load during SSR/tests. If config already exposes getters, consider using them here; otherwise please confirm API_BASE_URL is computed safely.


57-61: Normalize headers using HeadersInit; avoid setting Content-Type on GET

Current spread drops Headers instances and unconditionally sets Content-Type. Normalize and default to Accept: application/json; set Content-Type only when sending a body.

-    const headers: Record<string, string> = {
-      "Content-Type": "application/json",
-      ...((options.headers as Record<string, string>) || {}),
-    };
+    const headers = new Headers(options.headers as HeadersInit | undefined);
+    // Prefer Accept for reads; only set Content-Type if sending a body
+    if (!headers.has("Accept")) headers.set("Accept", "application/json");
+    if (options.body != null && !headers.has("Content-Type")) {
+      headers.set("Content-Type", "application/json");
+    }
@@
-    const response = await fetch(fullUrl, {
+    const response = await fetch(fullUrl, {
       ...options,
-      headers,
+      headers,
       signal: options.signal ?? AbortSignal.timeout(20000), // 20 second timeout (was 10s)
     });

Also applies to: 67-71

archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx (1)

5-5: Path update to shared/utils is correct; optional alias for consistency

Same note as elsewhere: consider alias to reduce deep relative paths.

-import { isOptimistic } from "../../../shared/utils/optimistic";
+import { isOptimistic } from "@/features/shared/utils/optimistic";
archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (1)

37-47: Add explicit generic to avoid implicit any on useQuery

Tighten typing for getProjectFeatures to match strict TS guidelines.

-  return useQuery({
+  return useQuery<Awaited<ReturnType<typeof projectService.getProjectFeatures>>>({
     queryKey: projectId ? projectKeys.features(projectId) : DISABLED_QUERY_KEY,
     queryFn: () => (projectId ? projectService.getProjectFeatures(projectId) : Promise.reject("No project ID")),
     enabled: !!projectId,
     staleTime: STALE_TIMES.normal,
   });
PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md (1)

11-11: Docs mostly aligned; two minor inconsistencies to fix

  • Smart Polling location: code imports useSmartPolling from shared/hooks; doc still points to features/ui/hooks. Please update to shared/hooks or note the re-export.
  • “Phase 1: Removed ETag cache layer” conflicts with current usage of apiClient ETag. Clarify that the custom cache layer was removed while HTTP ETag semantics remain via apiClient.

Also applies to: 33-33, 67-67, 86-86, 108-113

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3a5c33 and 23cb131.

📒 Files selected for processing (44)
  • PRPs/ai_docs/API_NAMING_CONVENTIONS.md (1 hunks)
  • PRPs/ai_docs/ARCHITECTURE.md (2 hunks)
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md (5 hunks)
  • PRPs/ai_docs/ETAG_IMPLEMENTATION.md (4 hunks)
  • PRPs/ai_docs/QUERY_PATTERNS.md (4 hunks)
  • PRPs/ai_docs/optimistic_updates.md (2 hunks)
  • archon-ui-main/src/App.tsx (1 hunks)
  • archon-ui-main/src/components/layout/hooks/useBackendHealth.ts (1 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (1 hunks)
  • archon-ui-main/src/features/knowledge/inspector/components/KnowledgeInspector.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/inspector/hooks/useInspectorPagination.ts (1 hunks)
  • archon-ui-main/src/features/knowledge/services/knowledgeService.ts (1 hunks)
  • archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts (4 hunks)
  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx (1 hunks)
  • archon-ui-main/src/features/mcp/components/McpConfigSection.tsx (2 hunks)
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts (1 hunks)
  • archon-ui-main/src/features/mcp/services/mcpApi.ts (1 hunks)
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts (1 hunks)
  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts (1 hunks)
  • archon-ui-main/src/features/progress/services/progressService.ts (1 hunks)
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx (1 hunks)
  • archon-ui-main/src/features/projects/documents/components/DocumentCard.tsx (1 hunks)
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts (1 hunks)
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (1 hunks)
  • archon-ui-main/src/features/projects/services/projectService.ts (1 hunks)
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx (1 hunks)
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts (1 hunks)
  • archon-ui-main/src/features/projects/tasks/services/taskService.ts (1 hunks)
  • archon-ui-main/src/features/projects/tasks/services/tests/taskService.test.ts (1 hunks)
  • archon-ui-main/src/features/settings/migrations/components/MigrationStatusCard.tsx (2 hunks)
  • archon-ui-main/src/features/settings/migrations/components/PendingMigrationsModal.tsx (5 hunks)
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts (1 hunks)
  • archon-ui-main/src/features/settings/migrations/services/migrationService.ts (1 hunks)
  • archon-ui-main/src/features/settings/version/components/UpdateBanner.tsx (1 hunks)
  • archon-ui-main/src/features/settings/version/components/VersionStatusCard.tsx (1 hunks)
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts (1 hunks)
  • archon-ui-main/src/features/settings/version/services/versionService.ts (1 hunks)
  • archon-ui-main/src/features/shared/api/apiClient.ts (1 hunks)
  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts (1 hunks)
  • archon-ui-main/src/features/shared/hooks/index.ts (1 hunks)
  • archon-ui-main/src/features/shared/hooks/useToast.ts (1 hunks)
  • archon-ui-main/src/features/shared/utils/tests/optimistic.test.ts (1 hunks)
  • archon-ui-main/src/features/testing/test-utils.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
archon-ui-main/src/features/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

archon-ui-main/src/features/**/*.{ts,tsx}: Use TanStack Query for all data fetching (no prop drilling); use smart HTTP polling (no WebSockets)
Biome formatting in features: 120-character line length, double quotes, and trailing commas
Apply Tron-inspired glassmorphism styling with Tailwind for feature UI

Use Biome in features: 120 character line length, double quotes, and trailing commas

Files:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/settings/version/components/UpdateBanner.tsx
  • archon-ui-main/src/features/mcp/components/McpConfigSection.tsx
  • archon-ui-main/src/features/shared/hooks/useToast.ts
  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/shared/api/apiClient.ts
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/knowledge/services/knowledgeService.ts
  • archon-ui-main/src/features/knowledge/inspector/components/KnowledgeInspector.tsx
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
  • archon-ui-main/src/features/progress/services/progressService.ts
  • archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts
  • archon-ui-main/src/features/settings/version/services/versionService.ts
  • archon-ui-main/src/features/settings/version/components/VersionStatusCard.tsx
  • archon-ui-main/src/features/mcp/services/mcpApi.ts
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/settings/migrations/components/MigrationStatusCard.tsx
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts
  • archon-ui-main/src/features/settings/migrations/services/migrationService.ts
  • archon-ui-main/src/features/knowledge/inspector/hooks/useInspectorPagination.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/projects/tasks/services/taskService.ts
  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts
  • archon-ui-main/src/features/projects/documents/components/DocumentCard.tsx
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts
  • archon-ui-main/src/features/projects/services/projectService.ts
  • archon-ui-main/src/features/testing/test-utils.tsx
  • archon-ui-main/src/features/projects/tasks/services/tests/taskService.test.ts
  • archon-ui-main/src/features/settings/migrations/components/PendingMigrationsModal.tsx
  • archon-ui-main/src/features/shared/utils/tests/optimistic.test.ts
  • archon-ui-main/src/features/shared/hooks/index.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
archon-ui-main/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Disallow implicit any in TypeScript

archon-ui-main/src/**/*.{ts,tsx}: Frontend TypeScript must use strict mode with no implicit any
Use TanStack Query for all data fetching; avoid prop drilling
Use database values directly in the frontend; avoid mapping layers between BE and FE types

Files:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/settings/version/components/UpdateBanner.tsx
  • archon-ui-main/src/features/mcp/components/McpConfigSection.tsx
  • archon-ui-main/src/features/shared/hooks/useToast.ts
  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/shared/api/apiClient.ts
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/knowledge/services/knowledgeService.ts
  • archon-ui-main/src/features/knowledge/inspector/components/KnowledgeInspector.tsx
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
  • archon-ui-main/src/features/progress/services/progressService.ts
  • archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts
  • archon-ui-main/src/features/settings/version/services/versionService.ts
  • archon-ui-main/src/App.tsx
  • archon-ui-main/src/features/settings/version/components/VersionStatusCard.tsx
  • archon-ui-main/src/features/mcp/services/mcpApi.ts
  • archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/settings/migrations/components/MigrationStatusCard.tsx
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts
  • archon-ui-main/src/features/settings/migrations/services/migrationService.ts
  • archon-ui-main/src/features/knowledge/inspector/hooks/useInspectorPagination.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/projects/tasks/services/taskService.ts
  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts
  • archon-ui-main/src/features/projects/documents/components/DocumentCard.tsx
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts
  • archon-ui-main/src/features/projects/services/projectService.ts
  • archon-ui-main/src/features/testing/test-utils.tsx
  • archon-ui-main/src/features/projects/tasks/services/tests/taskService.test.ts
  • archon-ui-main/src/features/settings/migrations/components/PendingMigrationsModal.tsx
  • archon-ui-main/src/features/shared/utils/tests/optimistic.test.ts
  • archon-ui-main/src/features/shared/hooks/index.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
archon-ui-main/src/**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Write frontend tests with Vitest and React Testing Library

Files:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts
  • archon-ui-main/src/features/projects/tasks/services/tests/taskService.test.ts
  • archon-ui-main/src/features/shared/utils/tests/optimistic.test.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
archon-ui-main/src/**/*.{ts,tsx,py}

📄 CodeRabbit inference engine (CLAUDE.md)

In code comments, avoid meta terms like SIMPLIFIED, ENHANCED, LEGACY, CHANGED, REMOVED; comment only on functionality and reasoning (do not mention beta/global rules)

Files:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/settings/version/components/UpdateBanner.tsx
  • archon-ui-main/src/features/mcp/components/McpConfigSection.tsx
  • archon-ui-main/src/features/shared/hooks/useToast.ts
  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/shared/api/apiClient.ts
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/knowledge/services/knowledgeService.ts
  • archon-ui-main/src/features/knowledge/inspector/components/KnowledgeInspector.tsx
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
  • archon-ui-main/src/features/progress/services/progressService.ts
  • archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts
  • archon-ui-main/src/features/settings/version/services/versionService.ts
  • archon-ui-main/src/App.tsx
  • archon-ui-main/src/features/settings/version/components/VersionStatusCard.tsx
  • archon-ui-main/src/features/mcp/services/mcpApi.ts
  • archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/settings/migrations/components/MigrationStatusCard.tsx
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts
  • archon-ui-main/src/features/settings/migrations/services/migrationService.ts
  • archon-ui-main/src/features/knowledge/inspector/hooks/useInspectorPagination.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/projects/tasks/services/taskService.ts
  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts
  • archon-ui-main/src/features/projects/documents/components/DocumentCard.tsx
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts
  • archon-ui-main/src/features/projects/services/projectService.ts
  • archon-ui-main/src/features/testing/test-utils.tsx
  • archon-ui-main/src/features/projects/tasks/services/tests/taskService.test.ts
  • archon-ui-main/src/features/settings/migrations/components/PendingMigrationsModal.tsx
  • archon-ui-main/src/features/shared/utils/tests/optimistic.test.ts
  • archon-ui-main/src/features/shared/hooks/index.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
archon-ui-main/src/features/*/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Place new UI components under the feature’s components directory

Place new UI components under src/features/[feature]/components

Files:

  • archon-ui-main/src/features/mcp/components/McpConfigSection.tsx
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx
archon-ui-main/src/features/*/hooks/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Place TanStack Query hooks in the feature’s hooks directory

Use feature-scoped TanStack Query hooks in src/features/[feature]/hooks

Files:

  • archon-ui-main/src/features/shared/hooks/useToast.ts
  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/shared/hooks/index.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
{PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md,PRPs/ai_docs/QUERY_PATTERNS.md}

📄 CodeRabbit inference engine (CLAUDE.md)

Adhere to documented TanStack Query architecture and patterns

Files:

  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • PRPs/ai_docs/QUERY_PATTERNS.md
🧠 Learnings (27)
📓 Common learnings
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/*/components/**/*.{ts,tsx} : Place new UI components under the feature’s components directory
📚 Learning: 2025-09-04T16:30:05.227Z
Learnt from: stevepresley
PR: coleam00/Archon#573
File: archon-ui-main/src/config/api.ts:15-25
Timestamp: 2025-09-04T16:30:05.227Z
Learning: Archon UI API config: Prefer lazy getters getApiFullUrl() and getWsUrl() over module-load constants to avoid SSR/test crashes. Avoid CommonJS exports patterns (Object.defineProperty(exports,…)) in ESM. Add typeof window guards with VITE_API_URL fallback inside getApiUrl()/getWebSocketUrl() when SSR safety is required.

Applied to files:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/shared/api/apiClient.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/features/settings/version/services/versionService.ts
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/features/*/types/**/*.{ts,tsx} : Define shared types under src/features/[feature]/types

Applied to files:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/shared/api/apiClient.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/App.tsx
  • PRPs/ai_docs/ARCHITECTURE.md
  • PRPs/ai_docs/optimistic_updates.md
  • archon-ui-main/src/features/shared/hooks/index.ts
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/**/*.test.{ts,tsx} : Write frontend tests with Vitest and React Testing Library

Applied to files:

  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/testing/test-utils.tsx
  • archon-ui-main/src/features/projects/tasks/services/tests/taskService.test.ts
📚 Learning: 2025-08-29T08:57:47.558Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/progressService.ts:0-0
Timestamp: 2025-08-29T08:57:47.558Z
Learning: The progressService.ts file was removed from the codebase in PR #514 as part of the consolidation effort to use the usePolling hook pattern from usePolling.ts instead of maintaining separate polling services. This aligns with the architectural decision to deprecate individual polling services in favor of the centralized hook-based approach.

Applied to files:

  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/progress/services/progressService.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching (no prop drilling); use smart HTTP polling (no WebSockets)

Applied to files:

  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
  • archon-ui-main/src/App.tsx
  • PRPs/ai_docs/ARCHITECTURE.md
  • archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts
  • archon-ui-main/src/features/settings/migrations/services/migrationService.ts
  • archon-ui-main/src/features/knowledge/inspector/hooks/useInspectorPagination.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/projects/tasks/services/taskService.ts
  • PRPs/ai_docs/API_NAMING_CONVENTIONS.md
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts
  • archon-ui-main/src/features/projects/services/projectService.ts
  • archon-ui-main/src/features/testing/test-utils.tsx
  • PRPs/ai_docs/ETAG_IMPLEMENTATION.md
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
📚 Learning: 2025-08-28T13:07:24.810Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/crawlProgressService.ts:35-39
Timestamp: 2025-08-28T13:07:24.810Z
Learning: The crawlProgressService.ts in the Archon codebase should be deprecated in favor of the existing useCrawlProgressPolling hook from usePolling.ts, which already includes ETag support, 304 handling, tab visibility detection, and proper React lifecycle integration. This consolidation reduces code duplication and improves performance.

Applied to files:

  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/features/progress/services/progressService.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/features/*/hooks/**/*.{ts,tsx} : Use feature-scoped TanStack Query hooks in src/features/[feature]/hooks

Applied to files:

  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
  • archon-ui-main/src/App.tsx
  • PRPs/ai_docs/ARCHITECTURE.md
  • archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts
  • archon-ui-main/src/features/knowledge/inspector/hooks/useInspectorPagination.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts
  • archon-ui-main/src/features/testing/test-utils.tsx
  • PRPs/ai_docs/ETAG_IMPLEMENTATION.md
  • archon-ui-main/src/features/shared/hooks/index.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
  • PRPs/ai_docs/QUERY_PATTERNS.md
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Use TanStack Query for all data fetching; avoid prop drilling

Applied to files:

  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/App.tsx
  • PRPs/ai_docs/ARCHITECTURE.md
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts
  • archon-ui-main/src/features/testing/test-utils.tsx
  • PRPs/ai_docs/ETAG_IMPLEMENTATION.md
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/*/hooks/**/*.{ts,tsx} : Place TanStack Query hooks in the feature’s hooks directory

Applied to files:

  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/App.tsx
  • PRPs/ai_docs/ARCHITECTURE.md
  • archon-ui-main/src/features/projects/documents/hooks/useDocumentQueries.ts
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts
  • archon-ui-main/src/features/shared/hooks/index.ts
  • archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts
  • PRPs/ai_docs/QUERY_PATTERNS.md
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to {PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md,PRPs/ai_docs/QUERY_PATTERNS.md} : Adhere to documented TanStack Query architecture and patterns

Applied to files:

  • archon-ui-main/src/features/knowledge/services/knowledgeService.ts
  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • PRPs/ai_docs/ARCHITECTURE.md
  • PRPs/ai_docs/ETAG_IMPLEMENTATION.md
  • PRPs/ai_docs/QUERY_PATTERNS.md
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/*/types/**/*.{ts,tsx} : Define feature-specific TypeScript types in the feature’s types directory

Applied to files:

  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Biome formatting in features: 120-character line length, double quotes, and trailing commas

Applied to files:

  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • archon-ui-main/src/App.tsx
  • archon-ui-main/src/features/settings/migrations/components/MigrationStatusCard.tsx
  • archon-ui-main/src/features/settings/migrations/components/PendingMigrationsModal.tsx
  • archon-ui-main/src/features/shared/hooks/index.ts
📚 Learning: 2025-08-28T12:06:56.383Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: python/src/server/utils/etag_utils.py:27-42
Timestamp: 2025-08-28T12:06:56.383Z
Learning: The ETag implementation in python/src/server/utils/etag_utils.py has known limitations with If-None-Match semantics (wildcards, multiple ETags, weak validators) that are documented in PRPs/ai_docs/ETAG_IMPLEMENTATION.md. These limitations are intentionally not addressed to keep the current implementation simple.

Applied to files:

  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
  • PRPs/ai_docs/ETAG_IMPLEMENTATION.md
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Apply Tron-inspired glassmorphism styling with Tailwind for feature UI

Applied to files:

  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/features/**/*.{tsx} : Apply Tron-inspired glassmorphism styling with Tailwind in feature UI components

Applied to files:

  • PRPs/ai_docs/DATA_FETCHING_ARCHITECTURE.md
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Use database values directly in the frontend; avoid mapping layers between BE and FE types

Applied to files:

  • archon-ui-main/src/App.tsx
  • PRPs/ai_docs/ARCHITECTURE.md
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use Biome in features: 120 character line length, double quotes, and trailing commas

Applied to files:

  • archon-ui-main/src/App.tsx
  • archon-ui-main/src/features/settings/migrations/components/MigrationStatusCard.tsx
  • archon-ui-main/src/features/shared/hooks/index.ts
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/features/*/components/**/*.{ts,tsx} : Place new UI components under src/features/[feature]/components

Applied to files:

  • archon-ui-main/src/App.tsx
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/*/components/**/*.{ts,tsx} : Place new UI components under the feature’s components directory

Applied to files:

  • archon-ui-main/src/App.tsx
📚 Learning: 2025-09-10T11:50:38.763Z
Learnt from: zaksnet
PR: coleam00/Archon#473
File: archon-ui-main/src/features/agents/components/provider-management/ProviderSettings.tsx:147-155
Timestamp: 2025-09-10T11:50:38.763Z
Learning: The Button component in archon-ui-main/src/components/ui/Button.tsx supports exactly these variants: 'primary', 'secondary', 'outline', and 'ghost'. The "primary" variant is valid and is actually the default variant for the component.

Applied to files:

  • archon-ui-main/src/features/settings/version/components/VersionStatusCard.tsx
📚 Learning: 2025-09-10T11:50:38.763Z
Learnt from: zaksnet
PR: coleam00/Archon#473
File: archon-ui-main/src/features/agents/components/provider-management/ProviderSettings.tsx:147-155
Timestamp: 2025-09-10T11:50:38.763Z
Learning: The Button component in archon-ui-main/src/components/ui/Button.tsx supports the "primary" variant along with: default, destructive, outline, secondary, ghost, link, and cyan.

Applied to files:

  • archon-ui-main/src/features/settings/version/components/VersionStatusCard.tsx
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx,py} : In code comments, avoid meta terms like SIMPLIFIED, ENHANCED, LEGACY, CHANGED, REMOVED; comment only on functionality and reasoning (do not mention beta/global rules)

Applied to files:

  • PRPs/ai_docs/ARCHITECTURE.md
  • PRPs/ai_docs/API_NAMING_CONVENTIONS.md
📚 Learning: 2025-08-28T12:56:47.840Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/pages/ProjectPage.tsx:329-331
Timestamp: 2025-08-28T12:56:47.840Z
Learning: In the ProjectPage.tsx polling refactor, temporary project creation logic with progress cards was removed in favor of simpler modal loading states, as the complexity of managing in-flight temporary projects wasn't justified when HTTP polling would show new projects within seconds anyway.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx
📚 Learning: 2025-08-28T13:50:10.499Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/pollingService.ts:38-45
Timestamp: 2025-08-28T13:50:10.499Z
Learning: The pollingService.ts file is being deprecated in favor of the usePolling hook from usePolling.ts. The team has decided to consolidate on the usePolling hook pattern rather than maintaining separate polling services, as it provides better React integration and reduces code duplication.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts
  • archon-ui-main/src/features/shared/hooks/index.ts
📚 Learning: 2025-08-28T13:51:59.203Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/pollingService.ts:60-102
Timestamp: 2025-08-28T13:51:59.203Z
Learning: The pollingService.ts file was removed from the codebase after initially being added in PR #514, confirming the team's decision to consolidate on the usePolling hook pattern rather than maintaining separate polling services.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
📚 Learning: 2025-08-28T13:51:59.203Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/pollingService.ts:60-102
Timestamp: 2025-08-28T13:51:59.203Z
Learning: The pollingService.ts file exists physically but is unused dead code in PR #514. It's only referenced in documentation but not imported anywhere in the TypeScript codebase. The actual polling implementation uses the usePolling hook from usePolling.ts instead.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
🧬 Code graph analysis (1)
archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts (1)
archon-ui-main/src/features/knowledge/utils/providerErrorHandler.ts (3)
  • parseProviderError (35-73)
  • ProviderError (6-11)
  • getProviderErrorMessage (78-102)
🔇 Additional comments (55)
archon-ui-main/src/features/knowledge/utils/tests/providerErrorHandler.test.ts (9)

1-2: Imports/path look correct post-reorg.

Vitest globals imported explicitly; relative path to utils is correct after the shared reorg.


5-35: Solid coverage for basic and HTTP‑style errors.

Covers Error objects, statusCode vs status, and precedence (statusCode wins). No issues.


37-54: Good backend-structured parsing assertion.

Validates isProviderError/provider/errorType/message mapping from JSON detail; aligns with utils implementation.


56-66: Graceful malformed‑JSON handling verified.

Test ensures parse doesn’t throw and preserves original message when JSON.parse fails.


92-125: Coverage for missing provider and partial payloads looks good.

Default provider fallback to "LLM" and message fallback to original JSON string are both exercised.


128-191: Provider‑specific messaging paths are well tested.

Authentication/quota/rate‑limit plus unknown type and default provider are all validated.


193-212: Non‑provider error handling is correct.

401 special‑case and generic passthrough/default message behaviors are verified.


214-228: End‑to‑end structured backend scenario covered.

Ensures getProviderErrorMessage integrates correctly with parsed structured errors.


245-280: TS strict‑mode guardrails validated.

Type‑safe access and absence of expected properties are exercised; matches coding guidelines.

archon-ui-main/src/features/knowledge/inspector/components/KnowledgeInspector.tsx (1)

7-7: Import path realignment LGTM — named export & return contract verified.

Confirmed: archon-ui-main/src/features/shared/utils/clipboard.ts exports export const copyToClipboard(text: string): Promise<ClipboardResult> where ClipboardResult = { success: boolean; method: "clipboard-api" | "execCommand" | "failed"; error?: string }. No default imports of copyToClipboard found; callers await the function and check result.success.

archon-ui-main/src/features/projects/documents/components/DocumentCard.tsx (1)

16-16: Import path update verified — new shared/utils/clipboard used consistently.
All imports resolve to src/features/shared/utils/clipboard and copyToClipboard is imported as a named export; no occurrences of shared/clipboard or apiWithEtag remain.

archon-ui-main/src/features/settings/migrations/services/migrationService.ts (1)

5-5: LGTM on path update

Import now points at the reorganized apiClient under shared/api. Matches the vertical-slice layout.

archon-ui-main/src/features/shared/api/tests/apiClient.test.ts (1)

2-3: LGTM on updated test imports

Tests now import APIServiceError and callAPIWithETag from the new modules.

archon-ui-main/src/features/projects/tasks/services/tests/taskService.test.ts (1)

2-9: LGTM on updated import and mock paths

Mocks and imports now target shared/api/apiClient consistently.

PRPs/ai_docs/API_NAMING_CONVENTIONS.md (1)

201-208: Doc path/location updates look correct

Time constants now reference shared/config/queryPatterns.ts; entries align with shared usage.

PRPs/ai_docs/ARCHITECTURE.md (2)

91-93: Config paths updated — OK

References now point to shared/config/{queryClient,queryPatterns}.ts.


142-142: API client reference updated — OK

Points to shared/api/apiClient.ts for browser-native caching note.

PRPs/ai_docs/QUERY_PATTERNS.md (4)

8-8: Shared pattern path updated — OK

Now uses shared/config/queryPatterns.ts.


52-53: Import snippet matches new layout

Importing DISABLED_QUERY_KEY and STALE_TIMES from shared/config.


109-109: Optimistic utils path updated — OK

Points to shared/utils/optimistic.


164-175: Test mock snippet updated — OK

Mocks align with new shared/config path and includes all STALE_TIMES fields.

archon-ui-main/src/features/projects/tasks/services/taskService.ts (1)

6-7: Approve — no stale imports found. rg returned no matches for 'shared/apiWithEtag' or 'shared/errors'; callAPIWithETag imports now reference shared/api/apiClient across the repo.

archon-ui-main/src/features/shared/hooks/index.ts (1)

3-3: LGTM: re-export remains intact.

No API change; formatting only.

archon-ui-main/src/features/settings/version/components/UpdateBanner.tsx (1)

57-59: Good: explicit type="button".

Prevents accidental form submit; accessibility unaffected.

archon-ui-main/src/features/knowledge/inspector/hooks/useInspectorPagination.ts (1)

8-8: STALE_TIMES import moved to config.

No behavioral change; hook remains consistent with query patterns.

archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts (1)

6-6: STALE_TIMES import path updated — constants verified
rare === 300_000 ms (5 minutes) and static === Infinity.

PRPs/ai_docs/ETAG_IMPLEMENTATION.md (1)

20-21: Docs/tests: apiClient intentionally relies on browser ETag/304; remove or update stale test reference

  • archon-ui-main/src/features/shared/api/apiClient.ts documents/exports callAPIWithETag and explicitly states we do NOT add If-None-Match or special 304 handling (browser HTTP cache handles ETags).
  • Stale reference found: archon-ui-main/src/features/shared/api/tests/apiClient.test.ts:9 — contains describe("apiWithEtag"); rename/remove or update tests/docs accordingly.

Likely an incorrect or invalid review comment.

archon-ui-main/src/App.tsx (1)

5-5: Approve: queryClient import path updated.
Verified no remaining imports of the old path; App.tsx and tests import from features/shared/config/queryClient.

archon-ui-main/src/features/settings/version/services/versionService.ts (1)

5-5: Switched to shared/api/apiClient — verified.

callAPIWithETag is exported from src/features/shared/api/apiClient.ts and imports across the repo reference it; no stale apiWithEtag imports found (only a test-suite name remains).

archon-ui-main/src/features/settings/version/components/VersionStatusCard.tsx (1)

31-33: Formatting-only change; retains type="button" semantics

No behavior change; good to keep explicit type to avoid unintended form submits.

archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts (1)

6-6: Correct remap to shared/config/queryPatterns

Matches the new structure; no functional change.

archon-ui-main/src/features/shared/hooks/useToast.ts (1)

3-3: Import remap to utils/optimistic is correct

No functional changes; hook API remains intact.

archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts (1)

24-24: Resolved — STALE_TIMES.frequent is defined in the centralized config
Found in archon-ui-main/src/features/shared/config/queryPatterns.ts (line 21): frequent: 5_000.

archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx (1)

7-7: Import path updated correctly for vertical slice architecture.

The import path has been properly updated to reflect the new organizational structure where shared hooks are now located under features/shared/hooks/.

archon-ui-main/src/features/testing/test-utils.tsx (1)

4-4: Import path updated correctly to align with the new config structure.

The import has been properly updated to use the new centralized configuration path ../shared/config/queryClient. This aligns with the broader reorganization moving query-related utilities under the config directory.

archon-ui-main/src/features/progress/services/progressService.ts (1)

6-6: Import path updated correctly for centralized API client.

The import has been properly updated to use the new centralized API client path ../../shared/api/apiClient. This follows the established pattern of moving shared utilities to more organized directories.

archon-ui-main/src/features/knowledge/services/knowledgeService.ts (1)

6-7: Import paths updated correctly for centralized API client and error types.

Both imports have been properly updated to reflect the new organizational structure:

  • API client moved to centralized ../../shared/api/apiClient
  • Error types moved to centralized ../../shared/types/errors

This aligns with the broader repository reorganization for better maintainability.

archon-ui-main/src/features/projects/services/projectService.ts (1)

6-7: Import paths updated correctly for centralized modules.

Both imports have been properly updated:

  • API client import moved to ../../shared/api/apiClient
  • Error utilities import moved to ../../shared/types/errors

This follows the established pattern of centralizing shared utilities for better maintainability.

archon-ui-main/src/features/progress/hooks/tests/useProgressQueries.test.ts (1)

22-22: Mock path updated correctly for centralized query patterns.

The mock import path has been properly updated to reflect the new location of query patterns under ../../../shared/config/queryPatterns. This ensures the test continues to work with the reorganized module structure.

archon-ui-main/src/features/progress/hooks/useProgressQueries.ts (2)

8-8: Import path updated correctly for centralized query patterns.

The import has been properly updated to use the new centralized configuration path ../../shared/config/queryPatterns. This follows the established pattern of moving shared configuration utilities to the config directory.


10-10: Import path updated correctly for centralized error types.

The import has been properly updated to use the new centralized types path ../../shared/types/errors. This aligns with the broader reorganization moving type definitions to the types directory.

archon-ui-main/src/features/shared/utils/tests/optimistic.test.ts (1)

1-9: Import reorg OK — STALE_TIMES verified

STALE_TIMES (archon-ui-main/src/features/shared/config/queryPatterns.ts) defines instant, realtime, frequent, normal, rare, static with expected numeric values and matches all referenced usages in hooks/tests.

archon-ui-main/src/features/settings/migrations/components/PendingMigrationsModal.tsx (4)

9-9: LGTM: path update to shared/utils/clipboard

Import path aligns with the new shared utils layout; copyToClipboard usage remains consistent.


96-103: LGTM: "Copy All Migrations" button formatting

Purely presentational change; no behavioral impact.


129-146: LGTM: action buttons formatting

Button semantics and handlers unchanged; type="button" correctly prevents unintended form submission.

Also applies to: 146-152


181-187: LGTM: footer buttons formatting

No functional differences; handlers and classes preserved.

Also applies to: 188-194

archon-ui-main/src/features/settings/migrations/components/MigrationStatusCard.tsx (2)

32-34: LGTM: refresh button formatting

No behavior changes; accessibility label retained.


104-106: LGTM: modal trigger button formatting

No behavior changes; handler intact.

archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (1)

2-3: LGTM: imports relocated to shared/hooks, shared/utils, and shared/config

Paths match the new vertical-slice structure; no logic changes.

Also applies to: 9-11

PRPs/ai_docs/optimistic_updates.md (3)

6-6: LGTM: optimistic utilities path

Doc now points to shared/utils/optimistic.ts.


76-76: LGTM: toast hook path

Doc reflects shared/hooks/useToast.ts; API unchanged.


82-82: LGTM: tests path

Doc path aligns with moved tests under shared/utils/tests.

archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (1)

8-11: LGTM: shared imports and query patterns path

Imports updated to shared/hooks, shared/utils, and shared/config; no runtime changes.

Also applies to: 14-15

archon-ui-main/src/components/layout/hooks/useBackendHealth.ts (1)

2-3: LGTM: apiClient/queryPatterns path updates

Hooks continue to use ETag client and shared retry/stale times; behavior preserved.

archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts (1)

5-9: LGTM: optimistic utils and query patterns path updates

Imports align with new shared locations; no logic changes.

import { Activity, CheckCircle2, ListTodo } from "lucide-react";
import type React from "react";
import { isOptimistic } from "../../shared/optimistic";
import { isOptimistic } from "../../shared/utils/optimistic";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 Analysis chain

Import path updated to utils/optimistic.

Consistent with new shared utils layout.


🏁 Script executed:

#!/bin/bash
# Ensure no remaining imports from the old shared/optimistic path
rg -nP 'features/shared/optimistic(?!/utils)' archon-ui-main/src || true

Length of output: 83


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Search for remaining imports referencing old optimistic paths
rg -n --hidden -S "shared/utils/optimistic" archon-ui-main/src || true
rg -n --hidden -S "features/shared/optimistic" archon-ui-main/src || true
rg -n --hidden -S "shared/optimistic" archon-ui-main/src || true
rg -n --hidden -S "(\.\./){1,5}shared/utils/optimistic" archon-ui-main/src || true

Length of output: 1179


Update remaining imports to '@/features/shared/utils/optimistic'

Three files still use the old relative import — switch them to the new shared utils path:

  • archon-ui-main/src/features/projects/components/ProjectCard.tsx — import { isOptimistic } from "../../shared/utils/optimistic";
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx — import { isOptimistic } from "../../../shared/utils/optimistic";
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx — import { isOptimistic } from "../../shared/utils/optimistic";
🤖 Prompt for AI Agents
In archon-ui-main/src/features/projects/components/ProjectCard.tsx around line
4, the import uses a relative path ("../../shared/utils/optimistic"); update it
to the new alias import '@/features/shared/utils/optimistic'. Also update the
two other listed files accordingly:
archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx (change
"../../../shared/utils/optimistic" to "@/features/shared/utils/optimistic") and
archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (change
"../../shared/utils/optimistic" to "@/features/shared/utils/optimistic"),
ensuring all three files import { isOptimistic } from the new path.

- Update imports to use @/features alias path for optimistic utils
- Fix optimistic upload item replacement by matching on source_id instead of id
- Clean up test suite naming and remove meta-terms from comments
- Only set Content-Type header on requests with body
- Add explicit TypeScript typing to useProjectFeatures hook
- Complete Phase 4 improvements with proper query typing
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (1)

205-209: Also clear feature queries for the deleted project.

Removing only the detail key leaves cached feature data for that project. Clear both to prevent stale cache and memory bloat.

Apply this diff:

     onSuccess: (_, projectId) => {
       // Don't refetch on success - trust optimistic update
       // Only remove the specific project's detail data (including nested keys)
       queryClient.removeQueries({ queryKey: projectKeys.detail(projectId), exact: false });
+      // Also remove the project's feature queries
+      queryClient.removeQueries({ queryKey: projectKeys.features(projectId), exact: false });
       showToast("Project deleted successfully", "success");
     },
🧹 Nitpick comments (3)
archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (1)

10-10: Prefer alias import for shared config to avoid brittle relative paths.

Using the "@/..." alias improves readability and reduces breakage during moves.

Apply this diff:

-import { DISABLED_QUERY_KEY, STALE_TIMES } from "../../shared/config/queryPatterns";
+import { DISABLED_QUERY_KEY, STALE_TIMES } from "@/features/shared/config/queryPatterns";
archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (2)

146-162: Use a native button for better a11y; remove custom key handling.

motion.button gives built‑in Enter/Space semantics and reduces event boilerplate.

-    <motion.div
-      className="relative group cursor-pointer"
-      role="button"
-      tabIndex={0}
+    <motion.button
+      type="button"
+      className="relative group cursor-pointer"
       onMouseEnter={() => setIsHovered(true)}
       onMouseLeave={() => setIsHovered(false)}
       onClick={onViewDocument}
-      onKeyDown={(e) => {
-        if (e.key === "Enter" || e.key === " ") {
-          e.preventDefault();
-          onViewDocument();
-        }
-      }}
       whileHover={{ scale: 1.02 }}
       transition={{ duration: 0.2 }}
     >
...
-    </motion.div>
+    </motion.button>

1-5: Tweak header comment to follow repo guidance (avoid meta terms).

Replace “Enhanced” with a neutral description per the guidelines.

 /**
- * Enhanced Knowledge Card Component
- * Individual knowledge item card with excellent UX and inline progress
+ * Knowledge Card component
+ * Displays a knowledge item with inline progress and status UI
  * Following the pattern from ProjectCard
  */
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23cb131 and cee1c0a.

📒 Files selected for processing (7)
  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (4 hunks)
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx (1 hunks)
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (2 hunks)
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx (1 hunks)
  • archon-ui-main/src/features/shared/api/apiClient.ts (2 hunks)
  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • archon-ui-main/src/features/projects/components/ProjectCard.tsx
  • archon-ui-main/src/features/shared/api/apiClient.ts
  • archon-ui-main/src/features/shared/api/tests/apiClient.test.ts
  • archon-ui-main/src/features/projects/tasks/components/TaskCard.tsx
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts
🧰 Additional context used
📓 Path-based instructions (5)
archon-ui-main/src/features/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

archon-ui-main/src/features/**/*.{ts,tsx}: Use TanStack Query for all data fetching (no prop drilling); use smart HTTP polling (no WebSockets)
Biome formatting in features: 120-character line length, double quotes, and trailing commas
Apply Tron-inspired glassmorphism styling with Tailwind for feature UI

Use Biome in features: 120 character line length, double quotes, and trailing commas

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
archon-ui-main/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Disallow implicit any in TypeScript

archon-ui-main/src/**/*.{ts,tsx}: Frontend TypeScript must use strict mode with no implicit any
Use TanStack Query for all data fetching; avoid prop drilling
Use database values directly in the frontend; avoid mapping layers between BE and FE types

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
archon-ui-main/src/features/*/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Place new UI components under the feature’s components directory

Place new UI components under src/features/[feature]/components

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
archon-ui-main/src/**/*.{ts,tsx,py}

📄 CodeRabbit inference engine (CLAUDE.md)

In code comments, avoid meta terms like SIMPLIFIED, ENHANCED, LEGACY, CHANGED, REMOVED; comment only on functionality and reasoning (do not mention beta/global rules)

Files:

  • archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
archon-ui-main/src/features/*/hooks/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Place TanStack Query hooks in the feature’s hooks directory

Use feature-scoped TanStack Query hooks in src/features/[feature]/hooks

Files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/*/components/**/*.{ts,tsx} : Place new UI components under the feature’s components directory
📚 Learning: 2025-09-19T10:31:54.277Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-19T10:31:54.277Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching (no prop drilling); use smart HTTP polling (no WebSockets)

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
📚 Learning: 2025-08-28T12:56:47.840Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/pages/ProjectPage.tsx:329-331
Timestamp: 2025-08-28T12:56:47.840Z
Learning: In the ProjectPage.tsx polling refactor, temporary project creation logic with progress cards was removed in favor of simpler modal loading states, as the complexity of managing in-flight temporary projects wasn't justified when HTTP polling would show new projects within seconds anyway.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
📚 Learning: 2025-09-19T10:32:55.557Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-19T10:32:55.557Z
Learning: Applies to archon-ui-main/src/features/*/hooks/**/*.{ts,tsx} : Use feature-scoped TanStack Query hooks in src/features/[feature]/hooks

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
📚 Learning: 2025-08-29T08:57:47.558Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/progressService.ts:0-0
Timestamp: 2025-08-29T08:57:47.558Z
Learning: The progressService.ts file was removed from the codebase in PR #514 as part of the consolidation effort to use the usePolling hook pattern from usePolling.ts instead of maintaining separate polling services. This aligns with the architectural decision to deprecate individual polling services in favor of the centralized hook-based approach.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
📚 Learning: 2025-08-28T13:50:10.499Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/pollingService.ts:38-45
Timestamp: 2025-08-28T13:50:10.499Z
Learning: The pollingService.ts file is being deprecated in favor of the usePolling hook from usePolling.ts. The team has decided to consolidate on the usePolling hook pattern rather than maintaining separate polling services, as it provides better React integration and reduces code duplication.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
📚 Learning: 2025-08-28T13:07:24.810Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/crawlProgressService.ts:35-39
Timestamp: 2025-08-28T13:07:24.810Z
Learning: The crawlProgressService.ts in the Archon codebase should be deprecated in favor of the existing useCrawlProgressPolling hook from usePolling.ts, which already includes ETag support, 304 handling, tab visibility detection, and proper React lifecycle integration. This consolidation reduces code duplication and improves performance.

Applied to files:

  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts
🧬 Code graph analysis (1)
archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (1)
archon-ui-main/src/features/projects/services/projectService.ts (1)
  • projectService (12-178)
🔇 Additional comments (3)
archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (2)

2-3: LGTM: shared hooks usage is consistent with the architectural guidelines.

Smart polling and toast hooks are correctly sourced from shared hooks.


39-44: Strong typing for query result.

Good use of Awaited<ReturnType<...>> to bind the query’s data type to the service function.

archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx (1)

13-13: Import path migration looks good — verify no remaining imports reference shared/optimistic.

archon-ui-main/src/features/knowledge/components/KnowledgeCard.tsx imports isOptimistic from "@/features/shared/utils/optimistic". Sandbox ripgrep skipped files, so run these locally and confirm zero matches:

rg -n -uu --hidden -S 'shared/optimistic' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' || true
rg -n -uu --hidden -S "@/features/shared/optimistic" --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' || true
rg -n -uu --hidden -S '\.\.?/.*shared/optimistic' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' || true

- Clear feature queries when deleting project to prevent cache memory leaks
- Update KnowledgeCard comments to follow documentation guidelines
- Add explanatory comment for accessibility pattern in KnowledgeCard
@Wirasm Wirasm merged commit 63a92cf into main Sep 22, 2025
8 checks passed
@Wirasm Wirasm deleted the refactor/reorganize-features-shared branch September 22, 2025 11:59
leonj1 pushed a commit to leonj1/Archon that referenced this pull request Oct 13, 2025
…lity (coleam00#730)

* refactor: reorganize features/shared directory structure

- Created organized subdirectories for better code organization:
  - api/ - API clients and HTTP utilities (renamed apiWithEtag.ts to apiClient.ts)
  - config/ - Configuration files (queryClient, queryPatterns)
  - types/ - Shared type definitions (errors)
  - utils/ - Pure utility functions (optimistic, clipboard)
  - hooks/ - Shared React hooks (already existed)

- Updated all import paths across the codebase (~40+ files)
- Updated all AI documentation in PRPs/ai_docs/ to reflect new structure
- All tests passing, build successful, no functional changes

This improves maintainability and follows vertical slice architecture patterns.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: address PR review comments and code improvements

- Update imports to use @/features alias path for optimistic utils
- Fix optimistic upload item replacement by matching on source_id instead of id
- Clean up test suite naming and remove meta-terms from comments
- Only set Content-Type header on requests with body
- Add explicit TypeScript typing to useProjectFeatures hook
- Complete Phase 4 improvements with proper query typing

* fix: address additional PR review feedback

- Clear feature queries when deleting project to prevent cache memory leaks
- Update KnowledgeCard comments to follow documentation guidelines
- Add explanatory comment for accessibility pattern in KnowledgeCard

---------

Co-authored-by: Claude <noreply@anthropic.com>
coleam00 added a commit that referenced this pull request Apr 7, 2026
* feat(web): live step & tool progress on Mission Control dashboard (#711)

- Emit tool_started/tool_completed events from workflow executor (sequential, loop, DAG)
- Bridge tool activity events to SSE as workflow_tool_activity
- Add __dashboard__ multiplexed SSE endpoint for all workflow events
- Extend DashboardWorkflowRun with current step name/status and agent counts via correlated subqueries (SQLite + PostgreSQL dialect-aware)
- Add useDashboardSSE hook connecting to __dashboard__ SSE stream
- Add handleWorkflowToolActivity to Zustand workflow store
- WorkflowRunCard subscribes to Zustand store directly for live step/tool updates
- DashboardPage hydrates store from REST data for active runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(web): correct event_index SQL bug, deduplicate CASE subquery, and type/code quality fixes

- Replace non-existent `event_index` column with `created_at` in all 8 correlated subqueries in `listDashboardRuns` (CRITICAL runtime fix — would crash dashboard for all users)
- Remove `current_step_event_index` field from `DashboardWorkflowRun` and `DashboardRunResponse` (field was never consumed by frontend)
- Deduplicate the triplicated `CASE` subquery into a single `CASE expr WHEN ...` form (HIGH performance/correctness fix)
- Add `WorkflowToolActivityEvent` to `SSEEvent` discriminated union in `types.ts` (MEDIUM type safety)
- Remove unused `sourceRef` from `useDashboardSSE` hook (MEDIUM YAGNI)
- Add `{ streamId: '__dashboard__' }` context object to all dashboard SSE log calls (MEDIUM logging compliance)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: totalSteps JSON key mismatch and extract IIFE to named component

- Fix total_steps always null: change jsonIntExtract key from 'totalSteps'
  to 'total_steps' to match what the executor writes
- Extract 25-line IIFE in WorkflowRunCard JSX to named StepProgress component
- Fix stepIndex > 0 guard to stepIndex != null (was hiding Step 0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: move WorkflowState import to top of file (ESLint import/first)

The import was placed after the PLATFORM_ICONS constant, violating
ESLint's import/first rule which fails CI with --max-warnings 0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(workflows): emit tool_started/tool_completed events from loop node executor

The loop node executor in dag-executor.ts was writing tool events to the
database but not emitting them via getWorkflowEventEmitter(). This meant
the WorkflowEventBridge never received tool activity events for loop
nodes, so the dashboard SSE stream had no workflow_tool_activity events
and the WorkflowRunCard's currentTool display stayed empty.

Add tool_started/tool_completed emitter calls to executeLoopNode(),
matching the pattern already used in executeNodeInternal() for regular
DAG nodes and executeStepInternal() for sequential steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(web): persist last tool activity on dashboard cards instead of flashing

currentTool was a plain string set on tool_started and cleared to null
on tool_completed, causing sub-second flashes that were invisible to
users. Change currentTool to a rich object { name, status, durationMs }
so completed tools display as "Read (5.7s)" in muted text and running
tools show as "Read…" in accent color, persisting until the next tool
starts or the workflow finishes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(web): make live tool progress prominent on dashboard cards

Move StepProgress out of the tiny metadata row into its own dedicated
section with a highlighted background. Step info renders at text-sm with
font-medium, tool calls in monospace. Running tools show a CSS spinner.
Much more visible than the previous inline text-xs rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
coleam00 pushed a commit that referenced this pull request Apr 7, 2026
…ole format (#805)

* refactor(workflows)!: remove sequential execution mode, DAG becomes sole format

Remove the steps-based (sequential) workflow execution mode entirely.
All workflows now use the nodes-based (DAG) format exclusively.

- Convert 8 sequential default workflows to DAG format
- Delete archon-fix-github-issue sequential (DAG version absorbs triggers)
- Remove SingleStep, ParallelBlock, StepWorkflow types and guards
- Gut executor.ts from ~2200 to ~730 lines (remove sequential loop)
- Remove step_started/completed/failed and parallel_agent_* events
- Remove logStepStart/Complete and logParallelBlockStart/Complete
- Delete SequentialEditor, StepProgress, ParallelBlockView components
- Remove sequential mode from workflow builder and execution views
- Delete executor.test.ts (4395 lines), update ~45 test fixtures
- Update CLAUDE.md and docs to reflect DAG-only format

BREAKING CHANGE: Workflows using `steps:` format are no longer supported.
Convert to `nodes:` (DAG) format. The loader provides a clear error message
directing users to the migration guide.

* fix: address review findings — guard errors, remove dead code, add tests

- Guard logNodeSkip/logWorkflowError against filesystem errors in dag-executor
- Move mkdir(artifactsDir) inside try-catch with user-friendly error
- Remove startFromStep dead parameter from executeWorkflow signature
- Remove isDagWorkflow() tautology and all callers (20+ sites)
- Remove dead BuilderMode/mode state from frontend components
- Remove vestigial isLoop, selectedStep, stepIndex, step_index fields
- Remove "DAG" prefix from user-facing resume/error messages
- Fix 5 stale docs (README, getting-started, authoring-commands, web adapter)
- Update event-emitter tests to use node events instead of removed step events
- Add executor-shared.test.ts (12 tests) for substituteWorkflowVariables
- Add executor.test.ts (11 tests) for concurrent-run, model resolution, resume

* fix(workflows): add migration guide, port preamble tests, improve error message

- Add docs/sequential-dag-migration-guide.md with 3 conversion patterns
  (single step, chain with clearContext, parallel block) and a Claude Code
  migration command for automated conversion
- Update loader error message to point to migration guide and include
  ready-to-run claude command
- Port 8 preamble tests from deleted executor.test.ts to new
  executor-preamble.test.ts: staleness detection (3), concurrent-run
  guard (3), DAG resume (2)

Addresses review feedback from #805.

* fix(workflows): update loader test to match new error message wording

* fix: address review findings — fail stuck runs, remove dead code, fix docs

- Mark workflow run as failed when artifacts mkdir fails (prevents
  15-min concurrent-run guard block)
- Remove vestigial totalSteps from WorkflowStartedEvent and executor
- Delete dead WorkflowToolbar.tsx (369 lines, no importers)
- Remove stepIndex prop from StepLogs (always 0, label now "Node logs")
- Restore cn() in StatusBar for consistent conditional classes
- Promote resume-check log to error, add errorType to failure logs
- Remove ghost $PLAN/$IMPLEMENTATION_SUMMARY from docs (never implemented)
- Update workflows.md rules to DAG-only format
- Fix migration guide trigger_rule example
- Clean up blank-line residues and stale comments

* fix: resolve rebase conflicts with #729 (forkSession) and #730 (dashboard)

- Remove sequential forkSession/persistSession code from #729 (dead after
  sequential removal)
- Fix loader type narrowing for DagNode context field
- Update dashboard components from #730 to use dagNodes instead of steps
- Remove WorkflowStepEvent/ParallelAgentEvent from dashboard SSE hook
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…leam00#730)

* feat(web): live step & tool progress on Mission Control dashboard (coleam00#711)

- Emit tool_started/tool_completed events from workflow executor (sequential, loop, DAG)
- Bridge tool activity events to SSE as workflow_tool_activity
- Add __dashboard__ multiplexed SSE endpoint for all workflow events
- Extend DashboardWorkflowRun with current step name/status and agent counts via correlated subqueries (SQLite + PostgreSQL dialect-aware)
- Add useDashboardSSE hook connecting to __dashboard__ SSE stream
- Add handleWorkflowToolActivity to Zustand workflow store
- WorkflowRunCard subscribes to Zustand store directly for live step/tool updates
- DashboardPage hydrates store from REST data for active runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(web): correct event_index SQL bug, deduplicate CASE subquery, and type/code quality fixes

- Replace non-existent `event_index` column with `created_at` in all 8 correlated subqueries in `listDashboardRuns` (CRITICAL runtime fix — would crash dashboard for all users)
- Remove `current_step_event_index` field from `DashboardWorkflowRun` and `DashboardRunResponse` (field was never consumed by frontend)
- Deduplicate the triplicated `CASE` subquery into a single `CASE expr WHEN ...` form (HIGH performance/correctness fix)
- Add `WorkflowToolActivityEvent` to `SSEEvent` discriminated union in `types.ts` (MEDIUM type safety)
- Remove unused `sourceRef` from `useDashboardSSE` hook (MEDIUM YAGNI)
- Add `{ streamId: '__dashboard__' }` context object to all dashboard SSE log calls (MEDIUM logging compliance)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: totalSteps JSON key mismatch and extract IIFE to named component

- Fix total_steps always null: change jsonIntExtract key from 'totalSteps'
  to 'total_steps' to match what the executor writes
- Extract 25-line IIFE in WorkflowRunCard JSX to named StepProgress component
- Fix stepIndex > 0 guard to stepIndex != null (was hiding Step 0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: move WorkflowState import to top of file (ESLint import/first)

The import was placed after the PLATFORM_ICONS constant, violating
ESLint's import/first rule which fails CI with --max-warnings 0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(workflows): emit tool_started/tool_completed events from loop node executor

The loop node executor in dag-executor.ts was writing tool events to the
database but not emitting them via getWorkflowEventEmitter(). This meant
the WorkflowEventBridge never received tool activity events for loop
nodes, so the dashboard SSE stream had no workflow_tool_activity events
and the WorkflowRunCard's currentTool display stayed empty.

Add tool_started/tool_completed emitter calls to executeLoopNode(),
matching the pattern already used in executeNodeInternal() for regular
DAG nodes and executeStepInternal() for sequential steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(web): persist last tool activity on dashboard cards instead of flashing

currentTool was a plain string set on tool_started and cleared to null
on tool_completed, causing sub-second flashes that were invisible to
users. Change currentTool to a rich object { name, status, durationMs }
so completed tools display as "Read (5.7s)" in muted text and running
tools show as "Read…" in accent color, persisting until the next tool
starts or the workflow finishes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(web): make live tool progress prominent on dashboard cards

Move StepProgress out of the tiny metadata row into its own dedicated
section with a highlighted background. Step info renders at text-sm with
font-medium, tool calls in monospace. Running tools show a CSS spinner.
Much more visible than the previous inline text-xs rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…ole format (coleam00#805)

* refactor(workflows)!: remove sequential execution mode, DAG becomes sole format

Remove the steps-based (sequential) workflow execution mode entirely.
All workflows now use the nodes-based (DAG) format exclusively.

- Convert 8 sequential default workflows to DAG format
- Delete archon-fix-github-issue sequential (DAG version absorbs triggers)
- Remove SingleStep, ParallelBlock, StepWorkflow types and guards
- Gut executor.ts from ~2200 to ~730 lines (remove sequential loop)
- Remove step_started/completed/failed and parallel_agent_* events
- Remove logStepStart/Complete and logParallelBlockStart/Complete
- Delete SequentialEditor, StepProgress, ParallelBlockView components
- Remove sequential mode from workflow builder and execution views
- Delete executor.test.ts (4395 lines), update ~45 test fixtures
- Update CLAUDE.md and docs to reflect DAG-only format

BREAKING CHANGE: Workflows using `steps:` format are no longer supported.
Convert to `nodes:` (DAG) format. The loader provides a clear error message
directing users to the migration guide.

* fix: address review findings — guard errors, remove dead code, add tests

- Guard logNodeSkip/logWorkflowError against filesystem errors in dag-executor
- Move mkdir(artifactsDir) inside try-catch with user-friendly error
- Remove startFromStep dead parameter from executeWorkflow signature
- Remove isDagWorkflow() tautology and all callers (20+ sites)
- Remove dead BuilderMode/mode state from frontend components
- Remove vestigial isLoop, selectedStep, stepIndex, step_index fields
- Remove "DAG" prefix from user-facing resume/error messages
- Fix 5 stale docs (README, getting-started, authoring-commands, web adapter)
- Update event-emitter tests to use node events instead of removed step events
- Add executor-shared.test.ts (12 tests) for substituteWorkflowVariables
- Add executor.test.ts (11 tests) for concurrent-run, model resolution, resume

* fix(workflows): add migration guide, port preamble tests, improve error message

- Add docs/sequential-dag-migration-guide.md with 3 conversion patterns
  (single step, chain with clearContext, parallel block) and a Claude Code
  migration command for automated conversion
- Update loader error message to point to migration guide and include
  ready-to-run claude command
- Port 8 preamble tests from deleted executor.test.ts to new
  executor-preamble.test.ts: staleness detection (3), concurrent-run
  guard (3), DAG resume (2)

Addresses review feedback from coleam00#805.

* fix(workflows): update loader test to match new error message wording

* fix: address review findings — fail stuck runs, remove dead code, fix docs

- Mark workflow run as failed when artifacts mkdir fails (prevents
  15-min concurrent-run guard block)
- Remove vestigial totalSteps from WorkflowStartedEvent and executor
- Delete dead WorkflowToolbar.tsx (369 lines, no importers)
- Remove stepIndex prop from StepLogs (always 0, label now "Node logs")
- Restore cn() in StatusBar for consistent conditional classes
- Promote resume-check log to error, add errorType to failure logs
- Remove ghost $PLAN/$IMPLEMENTATION_SUMMARY from docs (never implemented)
- Update workflows.md rules to DAG-only format
- Fix migration guide trigger_rule example
- Clean up blank-line residues and stale comments

* fix: resolve rebase conflicts with coleam00#729 (forkSession) and coleam00#730 (dashboard)

- Remove sequential forkSession/persistSession code from coleam00#729 (dead after
  sequential removal)
- Fix loader type narrowing for DagNode context field
- Update dashboard components from coleam00#730 to use dagNodes instead of steps
- Remove WorkflowStepEvent/ParallelAgentEvent from dashboard SSE hook
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…leam00#730)

* feat(web): live step & tool progress on Mission Control dashboard (coleam00#711)

- Emit tool_started/tool_completed events from workflow executor (sequential, loop, DAG)
- Bridge tool activity events to SSE as workflow_tool_activity
- Add __dashboard__ multiplexed SSE endpoint for all workflow events
- Extend DashboardWorkflowRun with current step name/status and agent counts via correlated subqueries (SQLite + PostgreSQL dialect-aware)
- Add useDashboardSSE hook connecting to __dashboard__ SSE stream
- Add handleWorkflowToolActivity to Zustand workflow store
- WorkflowRunCard subscribes to Zustand store directly for live step/tool updates
- DashboardPage hydrates store from REST data for active runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(web): correct event_index SQL bug, deduplicate CASE subquery, and type/code quality fixes

- Replace non-existent `event_index` column with `created_at` in all 8 correlated subqueries in `listDashboardRuns` (CRITICAL runtime fix — would crash dashboard for all users)
- Remove `current_step_event_index` field from `DashboardWorkflowRun` and `DashboardRunResponse` (field was never consumed by frontend)
- Deduplicate the triplicated `CASE` subquery into a single `CASE expr WHEN ...` form (HIGH performance/correctness fix)
- Add `WorkflowToolActivityEvent` to `SSEEvent` discriminated union in `types.ts` (MEDIUM type safety)
- Remove unused `sourceRef` from `useDashboardSSE` hook (MEDIUM YAGNI)
- Add `{ streamId: '__dashboard__' }` context object to all dashboard SSE log calls (MEDIUM logging compliance)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: totalSteps JSON key mismatch and extract IIFE to named component

- Fix total_steps always null: change jsonIntExtract key from 'totalSteps'
  to 'total_steps' to match what the executor writes
- Extract 25-line IIFE in WorkflowRunCard JSX to named StepProgress component
- Fix stepIndex > 0 guard to stepIndex != null (was hiding Step 0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: move WorkflowState import to top of file (ESLint import/first)

The import was placed after the PLATFORM_ICONS constant, violating
ESLint's import/first rule which fails CI with --max-warnings 0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(workflows): emit tool_started/tool_completed events from loop node executor

The loop node executor in dag-executor.ts was writing tool events to the
database but not emitting them via getWorkflowEventEmitter(). This meant
the WorkflowEventBridge never received tool activity events for loop
nodes, so the dashboard SSE stream had no workflow_tool_activity events
and the WorkflowRunCard's currentTool display stayed empty.

Add tool_started/tool_completed emitter calls to executeLoopNode(),
matching the pattern already used in executeNodeInternal() for regular
DAG nodes and executeStepInternal() for sequential steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(web): persist last tool activity on dashboard cards instead of flashing

currentTool was a plain string set on tool_started and cleared to null
on tool_completed, causing sub-second flashes that were invisible to
users. Change currentTool to a rich object { name, status, durationMs }
so completed tools display as "Read (5.7s)" in muted text and running
tools show as "Read…" in accent color, persisting until the next tool
starts or the workflow finishes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(web): make live tool progress prominent on dashboard cards

Move StepProgress out of the tiny metadata row into its own dedicated
section with a highlighted background. Step info renders at text-sm with
font-medium, tool calls in monospace. Running tools show a CSS spinner.
Much more visible than the previous inline text-xs rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…ole format (coleam00#805)

* refactor(workflows)!: remove sequential execution mode, DAG becomes sole format

Remove the steps-based (sequential) workflow execution mode entirely.
All workflows now use the nodes-based (DAG) format exclusively.

- Convert 8 sequential default workflows to DAG format
- Delete archon-fix-github-issue sequential (DAG version absorbs triggers)
- Remove SingleStep, ParallelBlock, StepWorkflow types and guards
- Gut executor.ts from ~2200 to ~730 lines (remove sequential loop)
- Remove step_started/completed/failed and parallel_agent_* events
- Remove logStepStart/Complete and logParallelBlockStart/Complete
- Delete SequentialEditor, StepProgress, ParallelBlockView components
- Remove sequential mode from workflow builder and execution views
- Delete executor.test.ts (4395 lines), update ~45 test fixtures
- Update CLAUDE.md and docs to reflect DAG-only format

BREAKING CHANGE: Workflows using `steps:` format are no longer supported.
Convert to `nodes:` (DAG) format. The loader provides a clear error message
directing users to the migration guide.

* fix: address review findings — guard errors, remove dead code, add tests

- Guard logNodeSkip/logWorkflowError against filesystem errors in dag-executor
- Move mkdir(artifactsDir) inside try-catch with user-friendly error
- Remove startFromStep dead parameter from executeWorkflow signature
- Remove isDagWorkflow() tautology and all callers (20+ sites)
- Remove dead BuilderMode/mode state from frontend components
- Remove vestigial isLoop, selectedStep, stepIndex, step_index fields
- Remove "DAG" prefix from user-facing resume/error messages
- Fix 5 stale docs (README, getting-started, authoring-commands, web adapter)
- Update event-emitter tests to use node events instead of removed step events
- Add executor-shared.test.ts (12 tests) for substituteWorkflowVariables
- Add executor.test.ts (11 tests) for concurrent-run, model resolution, resume

* fix(workflows): add migration guide, port preamble tests, improve error message

- Add docs/sequential-dag-migration-guide.md with 3 conversion patterns
  (single step, chain with clearContext, parallel block) and a Claude Code
  migration command for automated conversion
- Update loader error message to point to migration guide and include
  ready-to-run claude command
- Port 8 preamble tests from deleted executor.test.ts to new
  executor-preamble.test.ts: staleness detection (3), concurrent-run
  guard (3), DAG resume (2)

Addresses review feedback from coleam00#805.

* fix(workflows): update loader test to match new error message wording

* fix: address review findings — fail stuck runs, remove dead code, fix docs

- Mark workflow run as failed when artifacts mkdir fails (prevents
  15-min concurrent-run guard block)
- Remove vestigial totalSteps from WorkflowStartedEvent and executor
- Delete dead WorkflowToolbar.tsx (369 lines, no importers)
- Remove stepIndex prop from StepLogs (always 0, label now "Node logs")
- Restore cn() in StatusBar for consistent conditional classes
- Promote resume-check log to error, add errorType to failure logs
- Remove ghost $PLAN/$IMPLEMENTATION_SUMMARY from docs (never implemented)
- Update workflows.md rules to DAG-only format
- Fix migration guide trigger_rule example
- Clean up blank-line residues and stale comments

* fix: resolve rebase conflicts with coleam00#729 (forkSession) and coleam00#730 (dashboard)

- Remove sequential forkSession/persistSession code from coleam00#729 (dead after
  sequential removal)
- Fix loader type narrowing for DagNode context field
- Update dashboard components from coleam00#730 to use dagNodes instead of steps
- Remove WorkflowStepEvent/ParallelAgentEvent from dashboard SSE hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant